package com.tanhua.service;

import com.tanhua.domain.User;
import com.tanhua.dubbo.UserAPI;
import com.tanhua.interceptor.UserHolder;
import com.tanhua.vo.HuanxinVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class HuanxinService {

    @DubboReference
    private UserAPI userAPI;

    public HuanxinVo findHuanxinUser() {
        User user = userAPI.findById(Integer.valueOf(UserHolder.getUserId().toString()));
        if (user!=null){
            return new HuanxinVo(user.getHxUser(),user.getHxPassword());
        }
        return null;
    }
}
